﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace MyChart
{
    /// <summary>
    /// 表示 TargetLine 对象的集合
    /// </summary>
    public class CoordinateTargetLineCollection : TargetLineCollection
    {
        #region 方法

        /// <summary>
        /// 获取当前集合对应的 FusionChart Xml配置字符串
        /// </summary>
        /// <returns>Xml配置字符串</returns>
        public override string GetXmlString()
        {
            StringBuilder xml = new StringBuilder();
            xml.Append("<trendLines>");
            foreach (TargetLine line in TargetLines)
            {
                xml.Append("<line startValue='" + line.StartValue + "'" + (line.EnableEndValue ? " endValue='" + line.EndValue + "'" : "")
                    + (line.Color.ToArgb() != 0 ? " color='" + line.Color.ToArgb().ToString("X").Remove(0, 2) + "'" : "")
                    + " displayvalue='" + line.Text + "' thickness='" + line.BorderWidth + "'" + (line.IsDashed ? " dashed='1' dashGap='6' alpha='100'" : "")
                    + (!line.TextLeftAlign ? " valueOnRight='1'" : "") + " showOnTop='1' />");
            }
            xml.Append("</trendLines>");
            return xml.ToString();
        }

        #endregion
    }
}
